import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import asyncComponent from './Bundle';//动态加载组件，用作代码分割
import {
    BrowserRouter as Router,
    Route,
    Switch
} from 'react-router-dom';
import Adaptive from './huimei/component/adaptive/Adaptive';

const Home = asyncComponent(() => import("./huimei/home/Home"));//首页
const Service = asyncComponent(() => import("./huimei/service/Service"));//转诊申请
const System = asyncComponent(() => import("./huimei/system/Syetem"));//惠每医疗集团资源
const Advisory = asyncComponent(() => import("./huimei/advisory/Advisory"));//公司咨询
const Product = asyncComponent(() => import("./huimei/product/Product"));//惠每极致服务
const Enterprise = asyncComponent(() => import("./huimei/solution/enterprise/Enterprise"));//企业福利解决方案
const Insurance = asyncComponent(() => import("./huimei/solution/insurance/Insurance"));//金融机构解决方案
const Mechanism = asyncComponent(() => import('./huimei/solution/mechanism-solution/Mechanism'));//移动端企业福利&金融机构解决方案
const Hospital = asyncComponent(() => import("./huimei/solution/hospital/Hospital"));//医院解决方案
const Contact = asyncComponent(() => import("./huimei/contact/Contact"));//联系我们
const Best = asyncComponent(() => import("./huimei/company/Company"));//惠每极致医疗
const Details = asyncComponent(() => import("./huimei/advisory/details/Details"));//文章详情
const SolutionDetails = asyncComponent(() => import("./huimei/solution/component/details/Details"));//金融机构&企业福利解决方案详情页
const Example = asyncComponent(() => import('./huimei/advisory/source/example/Example'));//患者实例
const Zhuanzhen = asyncComponent(()=>import('./huimei/goods/zhuanzhen/Zhuanzhen'));//转诊服务
const Consultation = asyncComponent(()=>import('./huimei/goods/consultation/Consultation'));//远程会诊
const BingLi = asyncComponent(()=>import('./huimei/goods/bingli/BingLi'));//病理会诊
const Evaluation = asyncComponent(()=>import('./huimei/goods/evaluation/Evaluation'));//病历评估
const PhysicalExamination = asyncComponent(()=>import('./huimei/goods/physical-examination/PhysicalExamination'));//梅奥体检
const Strategy = asyncComponent(()=>import('./huimei/best/source/strategy/Strategy'));//公司战略
const Mayo = asyncComponent(()=>import('./huimei/best/source/medical/Medical'));//梅奥医疗
const NotFind = asyncComponent(()=>import('./huimei/notFind/NotFind'));//404页面
// const Test = asyncComponent(()=>import('./huimei/test/Test'));//测试layout组件
const Jkdc = asyncComponent(()=>import('./huimei/solution/jkdc/Jkdc'));//健康地产
const router = (home,best,insuracne,enterprise,solutionDetails)=>{
  return (
      <Router>
          <Switch>
              <Route exact path="/" component={home}/>
              <Route path="/service" component={Service}/>
              <Route path="/system" component={System}/>
              <Route path="/advisory" component={Advisory}/>
              <Route path="/product" component={Product}/>
              <Route path="/enterprise" component={enterprise}/>
              <Route path="/insurance" component={insuracne}/>
              <Route path="/hospital" component={Hospital}/>
              <Route path="/contact" component={Contact}/>
              <Route path="/best" component={best}/>
              <Route path="/details" component={Details}/>
              <Route path="/solution_details" component={solutionDetails}/>
              <Route path="/example" component={Example}/>
              <Route path="/zhuanzhenfuwu.html" component={Zhuanzhen}/>
              <Route path="/remote" component={Consultation}/>
              <Route path="/pathology" component={BingLi}/>
              <Route path="/assessment" component={Evaluation}/>
              <Route path="/tijian" component={PhysicalExamination}/>
              <Route path="/strategy" component={Strategy}/>
              <Route path="/mayo" component={Mayo}/>
              <Route path="/jkdc" component={Jkdc}/>
              <Route component={NotFind}/>
              {/*<Route path="/test" component={Test}/>*/}
          </Switch>
      </Router>
  )
};
ReactDOM.render(
    <Adaptive desktop={
        router(Home,Best,Insurance,Enterprise,SolutionDetails)
    } phone={
        router(Home,Best,Mechanism,Mechanism,Mechanism)
    } size={1200}/>
    , document.getElementById('root'));
